FROM registry.cn-shanghai.aliyuncs.com/shalousun/alpine-oraclejdk8-perf4j:1.0.2 as builder
WORKDIR application
COPY target/*.jar springboot-docker.jar
RUN java -Djarmode=layertools -jar springboot-docker.jar extract


FROM registry.cn-shanghai.aliyuncs.com/shalousun/alpine-oraclejdk8-perf4j:1.0.2
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/application/ ./

EXPOSE 8080
# default profiles
ENV PROFILES="dev"
# set jvm
ENV JAVA_OPTS="-server -Xmx512m -Xms512m -Djava.awt.headless=true"
ENTRYPOINT ["sh","-c","java  $JAVA_OPTS -Dspring.profiles.active=$PROFILES org.springframework.boot.loader.JarLauncher"]
